import { request } from '@boeyo/portal';

/**
 * 监测列表树形列表
 * null
 */
export const tree = (data) => {
  return request({
    url: '/monitoring/tree',
    method: 'POST',
    data,
  });
};

/**
 * 查询告警配置列表 查询告警配置列表
 * null
 */
export const areaConfigList = (params) => {
  return request({
    url: '/areaConfig/list',
    method: 'GET',
    params,
  });
};

/**
 * 测点列表 测点列表
 * null
 */
export const getInfo = (params) => {
  return request({
    url: '/areaConfig/pointList',
    method: 'GET',
    params,
  });
};

/**
 * 新增或修改区域告警配置 新增或修改区域告警配置
 * null
 */
export const saveOrUpdate = (data) => {
  return request({
    url: '/areaConfig/saveOrUpdate',
    method: 'POST',
    data,
  });
};

/**
 * 区域触发事件 区域触发事件
 * null
 */
export const areaEvent = (params) => {
  return request({
    url: '/event/areaEvent',
    method: 'GET',
    params,
  });
};

/**
 * 历史数据波形
 */
export const fetchHistoryData = (params) => {
  return request({
    url: 'deviceData/history',
    params,
    skipError: true,
  });
};

/**
 * 报告产出文件下载
 * null
 */
export const downloadGenerateById = (generateId, docType = 'pdf') => {
  return request({
    url: `/produce/downloadGenerateById/${generateId}/${docType}`,
    method: 'GET',
    responseType: 'blob',
    closeDownload: true,
  });
};

/**
 * 生成区域报告
 * null
 */
export const createEarthquakeData = (id) => {
  return request({
    url: `/produce/createEventRegionReport/${id}`,
    method: 'GET',
    skipError: true,
  });
};

/**
 * 傅立叶谱
 * null
 */
export const signal = (data) => {
  return request({
    url: `/deviceData/signal`,
    method: 'post',
    data,
  });
};

/**
 * 反应谱
 * null
 */
export const responseSpectrum = (data) => {
  return request({
    url: `/deviceData/responseSpectrum`,
    method: 'post',
    data,
  });
};
